package com.soup.lab.tools.faker.source;

import java.io.File;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;

public class FileSourceImpl implements FileSource {

    private final Path path;

    private final Charset charset;

    public FileSourceImpl(File file) {
        this(file, Charset.defaultCharset());
    }

    public FileSourceImpl(Path path) {
        this(path, Charset.defaultCharset());
    }

    public FileSourceImpl(String filePath) {
        this(filePath, Charset.defaultCharset());
    }

    public FileSourceImpl(File file, Charset charset) {
        this.path = file.toPath();
        this.charset = charset;
    }

    public FileSourceImpl(Path path, Charset charset) {
        this.path = path;
        this.charset = charset;
    }

    public FileSourceImpl(String filePath, Charset charset) {
        this.path = Paths.get(filePath);
        this.charset = charset;
    }

    @Override
    public File getFile() {
        return path.toFile();
    }

    @Override
    public Path getPath() {
        return path;
    }

    @Override
    public Charset getCharset() {
        return charset;
    }
}
